<?php

require_once 'AbstractService.php';


/**
 * 查询订单
 * Class QueryOrderService
 * time 2020/11/11 12:52
 * author zrone <xujining415@gmail.com>
 * copyright zrone <xujining415@gmail.com>
 */
class QueryOrderService extends AbstractService
{
    public function __invoke(string $orderId)
    {
        $logicParams = $this->getLogicParams($orderId);

        $result = $this->terminal($logicParams, 'QueryOrder');
        if (isset($result["OrderID"])) {
            // 其他信息不想写了
            echo '订单金额：' . $result['Money'];
        } elseif (isset($result['Code'])) {
            echo '无法获取有效的订单信息';
        } else {
            echo "请求失败，请刷新重试!";
        }
    }

    private function getLogicParams(string $orderId)
    {
        return [
            'OrderID' => $orderId
        ];
    }
}